﻿/********************************************************************************/
// <copyright file="SQLRepositoryBase.cs" company="Asia E-Business Solutions">
//     Copyright © 2012. All right reserved
// </copyright>
//
// <history>
//  <change who="Hieu Nguyen" date="11/12/2012 1:33:08 PM">Created</change>
// <history>
/********************************************************************************/

namespace JLL.China.Infrastructure.Repositories
{
    using System;
    using System.Collections.Generic;
    using System.Data.Linq;
    using JLL.China.Infrastructure.DomainBase;
    using JLL.China.Infrastructure.RepositoryFramework;
    using JLL.China.Infrastructure.Repositories.LINQ2SQL;
    using LINQ = JLL.China.Infrastructure.Repositories.LINQ2SQL;

   public abstract class SQLRepositoryBase<E,T>:RepositoryBase<E,T>
       where E: IAggregateRoot<T>
       where T:new()
    {
       protected virtual JLLCHINADataContext DataContext
       {
           get
           {
               return ObjectFactory.Resolve<JLLCHINADataContext>();
           }
       }

       protected void SetLoadOptions(DataLoadOptions dataloadOptions)
       {
           try
           {
               this.DataContext.LoadOptions = dataloadOptions;
           }
           catch { }
       }
       protected DataLoadOptions GetDefaultLoadOptions()
       {
           var loadOptions = new System.Data.Linq.DataLoadOptions();

           return loadOptions;
       }
    }
}
